<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>
	<body>
		<script>
			// 写一个正则表达式，用于验证字符串内容为'abc'
			const regex = /abc/;
			let string = "abcd";

			// 验证指定的字符错是否满足正则模式，满足返回true，不满足返回false
			console.log(regex.test(string));

			// 需求一：验证6~12位的字母和数字
			const regex2 = /^[a-zA-Z0-9]{6,12}$/;
			console.log(regex2.test("abc12"));
			// 需求二：验证手机号
			const regex3 =
				/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
			console.log(regex3.test("18688888888"));
			// 需求三：6~12的密码
			const regex4 = /^\w{6,12}$/;
			console.log(regex4.test("1868888888，"));
		</script>
	</body>
</html>
